#include "__cf_SY33.h"
#include <math.h>
#include "SY33_acc.h"
#include "SY33_acc_private.h"
#include <stdio.h>
#include "slexec_vm_simstruct_bridge.h"
#include "slexec_vm_zc_functions.h"
#include "slexec_vm_lookup_functions.h"
#include "slsv_diagnostic_codegen_c_api.h"
#include "simtarget/slSimTgtMdlrefSfcnBridge.h"
#include "simstruc.h"
#include "fixedpoint.h"
#define CodeFormat S-Function
#define AccDefine1 Accelerator_S-Function
#include "simtarget/slAccSfcnBridge.h"
#ifndef __RTW_UTFREE__  
extern void * utMalloc ( size_t ) ; extern void utFree ( void * ) ;
#endif
boolean_T SY33_acc_rt_TDelayUpdateTailOrGrowBuf ( int_T * bufSzPtr , int_T *
tailPtr , int_T * headPtr , int_T * lastPtr , real_T tMinusDelay , real_T * *
tBufPtr , real_T * * uBufPtr , real_T * * xBufPtr , boolean_T isfixedbuf ,
boolean_T istransportdelay , int_T * maxNewBufSzPtr ) { int_T testIdx ; int_T
tail = * tailPtr ; int_T bufSz = * bufSzPtr ; real_T * tBuf = * tBufPtr ;
real_T * xBuf = ( NULL ) ; int_T numBuffer = 2 ; if ( istransportdelay ) {
numBuffer = 3 ; xBuf = * xBufPtr ; } testIdx = ( tail < ( bufSz - 1 ) ) ? (
tail + 1 ) : 0 ; if ( ( tMinusDelay <= tBuf [ testIdx ] ) && ! isfixedbuf ) {
int_T j ; real_T * tempT ; real_T * tempU ; real_T * tempX = ( NULL ) ;
real_T * uBuf = * uBufPtr ; int_T newBufSz = bufSz + 1024 ; if ( newBufSz > *
maxNewBufSzPtr ) { * maxNewBufSzPtr = newBufSz ; } tempU = ( real_T * )
utMalloc ( numBuffer * newBufSz * sizeof ( real_T ) ) ; if ( tempU == ( NULL
) ) { return ( false ) ; } tempT = tempU + newBufSz ; if ( istransportdelay )
tempX = tempT + newBufSz ; for ( j = tail ; j < bufSz ; j ++ ) { tempT [ j -
tail ] = tBuf [ j ] ; tempU [ j - tail ] = uBuf [ j ] ; if ( istransportdelay
) tempX [ j - tail ] = xBuf [ j ] ; } for ( j = 0 ; j < tail ; j ++ ) { tempT
[ j + bufSz - tail ] = tBuf [ j ] ; tempU [ j + bufSz - tail ] = uBuf [ j ] ;
if ( istransportdelay ) tempX [ j + bufSz - tail ] = xBuf [ j ] ; } if ( *
lastPtr > tail ) { * lastPtr -= tail ; } else { * lastPtr += ( bufSz - tail )
; } * tailPtr = 0 ; * headPtr = bufSz ; utFree ( uBuf ) ; * bufSzPtr =
newBufSz ; * tBufPtr = tempT ; * uBufPtr = tempU ; if ( istransportdelay ) *
xBufPtr = tempX ; } else { * tailPtr = testIdx ; } return ( true ) ; } real_T
SY33_acc_rt_VTDelayfindtDInterpolate ( real_T x , real_T * tBuf , real_T *
uBuf , real_T * xBuf , int_T bufSz , int_T head , int_T tail , int_T * pLast
, real_T t , real_T tStart , boolean_T discrete , boolean_T
minorStepAndTAtLastMajorOutput , real_T initOutput , real_T * appliedDelay )
{ int_T n , k ; real_T f ; int_T kp1 ; real_T tminustD , tL , tR , uD , uL ,
uR , fU ; if ( minorStepAndTAtLastMajorOutput ) { if ( * pLast == head ) { *
pLast = ( * pLast == 0 ) ? bufSz - 1 : * pLast - 1 ; } head = ( head == 0 ) ?
bufSz - 1 : head - 1 ; } if ( x <= 1 ) { return initOutput ; } k = * pLast ;
n = 0 ; for ( ; ; ) { n ++ ; if ( n > bufSz ) break ; if ( x - xBuf [ k ] >
1.0 ) { if ( k == head ) { int_T km1 ; f = ( x - 1.0 - xBuf [ k ] ) / ( x -
xBuf [ k ] ) ; tminustD = ( 1.0 - f ) * tBuf [ k ] + f * t ; km1 = k - 1 ; if
( km1 < 0 ) km1 = bufSz - 1 ; tL = tBuf [ km1 ] ; tR = tBuf [ k ] ; uL = uBuf
[ km1 ] ; uR = uBuf [ k ] ; break ; } kp1 = k + 1 ; if ( kp1 == bufSz ) kp1 =
0 ; if ( x - xBuf [ kp1 ] <= 1.0 ) { f = ( x - 1.0 - xBuf [ k ] ) / ( xBuf [
kp1 ] - xBuf [ k ] ) ; tL = tBuf [ k ] ; tR = tBuf [ kp1 ] ; uL = uBuf [ k ]
; uR = uBuf [ kp1 ] ; tminustD = ( 1.0 - f ) * tL + f * tR ; break ; } k =
kp1 ; } else { if ( k == tail ) { f = ( x - 1.0 ) / xBuf [ k ] ; if (
discrete ) { return ( uBuf [ tail ] ) ; } kp1 = k + 1 ; if ( kp1 == bufSz )
kp1 = 0 ; tminustD = ( 1 - f ) * tStart + f * tBuf [ k ] ; tL = tBuf [ k ] ;
tR = tBuf [ kp1 ] ; uL = uBuf [ k ] ; uR = uBuf [ kp1 ] ; break ; } k = k - 1
; if ( k < 0 ) k = bufSz - 1 ; } } * pLast = k ; if ( tR == tL ) { fU = 1.0 ;
} else { fU = ( tminustD - tL ) / ( tR - tL ) ; } if ( discrete ) { uD = ( fU
> ( 1.0 - fU ) ) ? uR : uL ; } else { uD = ( 1.0 - fU ) * uL + fU * uR ; } *
appliedDelay = t - tminustD ; return uD ; } void rt_ssGetBlockPath (
SimStruct * S , int_T sysIdx , int_T blkIdx , char_T * * path ) {
_ssGetBlockPath ( S , sysIdx , blkIdx , path ) ; } void rt_ssSet_slErrMsg (
SimStruct * S , void * diag ) { if ( ! _ssIsErrorStatusAslErrMsg ( S ) ) {
_ssSet_slErrMsg ( S , diag ) ; } else { _ssDiscardDiagnostic ( S , diag ) ; }
} void rt_ssReportDiagnosticAsWarning ( SimStruct * S , void * diag ) {
_ssReportDiagnosticAsWarning ( S , diag ) ; } void
SY33_Subsystempi2delay_Init ( SimStruct * S , B_Subsystempi2delay_SY33_T *
localB , P_Subsystempi2delay_SY33_T * localP ) { localB -> B_2_0_0 = localP
-> P_0 [ 0 ] ; localB -> B_2_1_0 = localP -> P_0 [ 1 ] ; } void
SY33_Subsystempi2delay_Disable ( SimStruct * S , DW_Subsystempi2delay_SY33_T
* localDW ) { localDW -> Subsystempi2delay_MODE = false ; } void
SY33_Subsystempi2delay ( SimStruct * S , uint8_T rtu_Enable , const real_T
rtu_alpha_beta [ 2 ] , real_T rtu_wt , B_Subsystempi2delay_SY33_T * localB ,
DW_Subsystempi2delay_SY33_T * localDW ) { int32_T isHit ; isHit =
ssIsSampleHit ( S , 1 , 0 ) ; if ( ( isHit != 0 ) && ( ssIsMajorTimeStep ( S
) != 0 ) ) { if ( rtu_Enable > 0 ) { if ( ! localDW -> Subsystempi2delay_MODE
) { if ( ssGetTaskTime ( S , 1 ) != ssGetTStart ( S ) ) {
ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; } localDW ->
Subsystempi2delay_MODE = true ; } } else { if ( localDW ->
Subsystempi2delay_MODE ) { ssSetBlockStateForSolverChangedAtMajorStep ( S ) ;
SY33_Subsystempi2delay_Disable ( S , localDW ) ; } } } if ( localDW ->
Subsystempi2delay_MODE ) { localB -> B_2_0_0 = rtu_alpha_beta [ 0 ] *
muDoubleScalarSin ( rtu_wt ) - rtu_alpha_beta [ 1 ] * muDoubleScalarCos (
rtu_wt ) ; localB -> B_2_1_0 = rtu_alpha_beta [ 0 ] * muDoubleScalarCos (
rtu_wt ) + rtu_alpha_beta [ 1 ] * muDoubleScalarSin ( rtu_wt ) ; if (
ssIsMajorTimeStep ( S ) != 0 ) { srUpdateBC ( localDW ->
Subsystempi2delay_SubsysRanBC ) ; } } } void SY33_Subsystempi2delay_Term (
SimStruct * const S ) { } void SY33_Subsystem1_Init ( SimStruct * S ,
B_Subsystem1_SY33_T * localB , P_Subsystem1_SY33_T * localP ) { localB ->
B_3_0_0 = localP -> P_0 [ 0 ] ; localB -> B_3_1_0 = localP -> P_0 [ 1 ] ; }
void SY33_Subsystem1_Disable ( SimStruct * S , DW_Subsystem1_SY33_T * localDW
) { localDW -> Subsystem1_MODE = false ; } void SY33_Subsystem1 ( SimStruct *
S , uint8_T rtu_Enable , const real_T rtu_alpha_beta [ 2 ] , real_T rtu_wt ,
B_Subsystem1_SY33_T * localB , DW_Subsystem1_SY33_T * localDW ) { int32_T
isHit ; isHit = ssIsSampleHit ( S , 1 , 0 ) ; if ( ( isHit != 0 ) && (
ssIsMajorTimeStep ( S ) != 0 ) ) { if ( rtu_Enable > 0 ) { if ( ! localDW ->
Subsystem1_MODE ) { if ( ssGetTaskTime ( S , 1 ) != ssGetTStart ( S ) ) {
ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; } localDW ->
Subsystem1_MODE = true ; } } else { if ( localDW -> Subsystem1_MODE ) {
ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; SY33_Subsystem1_Disable (
S , localDW ) ; } } } if ( localDW -> Subsystem1_MODE ) { localB -> B_3_0_0 =
rtu_alpha_beta [ 0 ] * muDoubleScalarCos ( rtu_wt ) + rtu_alpha_beta [ 1 ] *
muDoubleScalarSin ( rtu_wt ) ; localB -> B_3_1_0 = - rtu_alpha_beta [ 0 ] *
muDoubleScalarSin ( rtu_wt ) + rtu_alpha_beta [ 1 ] * muDoubleScalarCos (
rtu_wt ) ; if ( ssIsMajorTimeStep ( S ) != 0 ) { srUpdateBC ( localDW ->
Subsystem1_SubsysRanBC ) ; } } } void SY33_Subsystem1_Term ( SimStruct *
const S ) { } static void mdlOutputs ( SimStruct * S , int_T tid ) {
boolean_T resetSolver ; boolean_T didZcEventOccur ; real_T deltaT ; real_T
rateLimiterRate ; real_T pLastY ; real_T riseValLimit ; ZCEventType zcEvent [
6 ] ; real_T rtb_B_9_54_0 [ 6 ] ; boolean_T rtb_B_9_60_0 [ 6 ] ; boolean_T
tmp [ 6 ] ; int32_T i ; int32_T isHit ; B_SY33_T * _rtB ; P_SY33_T * _rtP ;
X_SY33_T * _rtX ; PrevZCX_SY33_T * _rtZCE ; DW_SY33_T * _rtDW ; _rtDW = ( (
DW_SY33_T * ) ssGetRootDWork ( S ) ) ; _rtZCE = ( ( PrevZCX_SY33_T * )
_ssGetPrevZCSigState ( S ) ) ; _rtX = ( ( X_SY33_T * ) ssGetContStates ( S )
) ; _rtP = ( ( P_SY33_T * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( B_SY33_T * )
_ssGetModelBlockIO ( S ) ) ; _rtB -> B_9_0_0 = muDoubleScalarSin ( _rtP ->
P_24 * ssGetTaskTime ( S , 0 ) + _rtP -> P_25 ) * _rtP -> P_22 + _rtP -> P_23
; _rtB -> B_9_1_0 = muDoubleScalarSin ( _rtP -> P_28 * ssGetTaskTime ( S , 0
) + _rtP -> P_29 ) * _rtP -> P_26 + _rtP -> P_27 ; _rtB -> B_9_2_0 =
muDoubleScalarSin ( _rtP -> P_32 * ssGetTaskTime ( S , 0 ) + _rtP -> P_33 ) *
_rtP -> P_30 + _rtP -> P_31 ; ssCallAccelRunBlock ( S , 9 , 3 ,
SS_CALL_MDL_OUTPUTS ) ; isHit = ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit != 0
) { if ( ssIsMajorTimeStep ( S ) != 0 ) { _rtDW -> RelationalOperator_Mode =
( _rtX -> Integrator_CSTATE > _rtB -> B_9_3_0_k ) ; } _rtB -> B_9_4_0_l =
_rtDW -> RelationalOperator_Mode ; } _rtB -> B_9_5_0 = _rtX ->
Integrator_CSTATE - _rtB -> B_9_3_0_k ; if ( ( _rtDW ->
Initial_FirstOutputTime == ( rtMinusInf ) ) || ( _rtDW ->
Initial_FirstOutputTime == ssGetTaskTime ( S , 0 ) ) ) { _rtDW ->
Initial_FirstOutputTime = ssGetTaskTime ( S , 0 ) ; _rtB -> B_9_6_0 = _rtP ->
P_54 ; } else { _rtB -> B_9_6_0 = _rtB -> B_9_5_0 ; } if ( ssIsMajorTimeStep
( S ) != 0 ) { didZcEventOccur = ( _rtB -> B_9_4_0_l && ( _rtZCE ->
Integrator_Reset_ZCE != POS_ZCSIG ) ) ; _rtZCE -> Integrator_Reset_ZCE = _rtB
-> B_9_4_0_l ; if ( didZcEventOccur || ( _rtDW -> Integrator_IWORK != 0 ) ) {
_rtX -> Integrator_CSTATE = _rtB -> B_9_6_0 ;
ssSetBlockStateForSolverChangedAtMajorStep ( S ) ;
ssSetContTimeOutputInconsistentWithStateAtMajorStep ( S ) ; } if ( _rtX ->
Integrator_CSTATE >= _rtP -> P_55 ) { _rtX -> Integrator_CSTATE = _rtP ->
P_55 ; } else { if ( _rtX -> Integrator_CSTATE <= _rtP -> P_56 ) { _rtX ->
Integrator_CSTATE = _rtP -> P_56 ; } } } _rtB -> B_9_7_0 = _rtX ->
Integrator_CSTATE ; isHit = ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit != 0 ) {
_rtB -> B_9_9_0 = _rtDW -> Memory_PreviousInput ; if ( ssIsMajorTimeStep ( S
) != 0 ) { if ( _rtB -> B_9_2_0_c > 0.0 ) { if ( ! _rtDW ->
AutomaticGainControl_MODE ) { if ( ssGetTaskTime ( S , 1 ) != ssGetTStart ( S
) ) { ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; } ( void ) memset (
& ( ( ( XDis_SY33_T * ) ssGetContStateDisabled ( S ) ) ->
VariableTransportDelay_CSTATE_o ) , 0 , 4 * sizeof ( boolean_T ) ) ; _rtDW ->
AutomaticGainControl_MODE = true ; } } else { if ( _rtDW ->
AutomaticGainControl_MODE ) { ssSetBlockStateForSolverChangedAtMajorStep ( S
) ; ( void ) memset ( & ( ( ( XDis_SY33_T * ) ssGetContStateDisabled ( S ) )
-> VariableTransportDelay_CSTATE_o ) , 1 , 4 * sizeof ( boolean_T ) ) ; if (
_rtDW -> Subsystempi2delay_f . Subsystempi2delay_MODE ) {
SY33_Subsystempi2delay_Disable ( S , & _rtDW -> Subsystempi2delay_f ) ; } if
( _rtDW -> Subsystem1_a . Subsystem1_MODE ) { SY33_Subsystem1_Disable ( S , &
_rtDW -> Subsystem1_a ) ; } _rtDW -> AutomaticGainControl_MODE = false ; } }
} } if ( _rtDW -> AutomaticGainControl_MODE ) { { real_T * * uBuffer = (
real_T * * ) & _rtDW -> VariableTransportDelay_PWORK_a . TUbufferPtrs [ 0 ] ;
real_T * * tBuffer = ( real_T * * ) & _rtDW -> VariableTransportDelay_PWORK_a
. TUbufferPtrs [ 1 ] ; real_T * * xBuffer = ( real_T * * ) & _rtDW ->
VariableTransportDelay_PWORK_a . TUbufferPtrs [ 2 ] ; real_T simTime = ssGetT
( S ) ; real_T appliedDelay ; _rtB -> B_4_0_0 =
SY33_acc_rt_VTDelayfindtDInterpolate ( ( ( X_SY33_T * ) ssGetContStates ( S )
) -> VariableTransportDelay_CSTATE_o , * tBuffer , * uBuffer , * xBuffer ,
_rtDW -> VariableTransportDelay_IWORK_e . CircularBufSize , _rtDW ->
VariableTransportDelay_IWORK_e . Head , _rtDW ->
VariableTransportDelay_IWORK_e . Tail , & _rtDW ->
VariableTransportDelay_IWORK_e . Last , simTime , 0.0 , 0 , ( boolean_T ) (
ssIsMinorTimeStep ( S ) && ( ssGetTimeOfLastOutput ( S ) == ssGetT ( S ) ) )
, _rtP -> P_2 , & appliedDelay ) ; } _rtB -> B_4_1_0 = _rtX ->
integrator_CSTATE_n ; _rtB -> B_4_2_0 = ssGetT ( S ) ; isHit = ssIsSampleHit
( S , 1 , 0 ) ; if ( isHit != 0 ) { if ( ssIsMajorTimeStep ( S ) != 0 ) {
_rtDW -> RelationalOperator_Mode_p = ( _rtB -> B_4_2_0 >= _rtB -> B_4_0_0_n )
; } _rtB -> B_4_3_0 = _rtDW -> RelationalOperator_Mode_p ; _rtB -> B_4_4_0 =
_rtDW -> Memory_PreviousInput_b ; } if ( _rtB -> B_4_3_0 ) { _rtB -> B_0_0_0
= _rtB -> B_4_1_0 - _rtB -> B_4_0_0 ; _rtB -> B_0_1_0 = _rtB -> B_0_0_0 *
_rtB -> B_9_9_0 ; _rtB -> B_4_6_0 = _rtB -> B_0_1_0 ; } else { _rtB ->
B_4_6_0 = _rtB -> B_4_4_0 ; } { real_T * * uBuffer = ( real_T * * ) & _rtDW
-> VariableTransportDelay_PWORK_az . TUbufferPtrs [ 0 ] ; real_T * * tBuffer
= ( real_T * * ) & _rtDW -> VariableTransportDelay_PWORK_az . TUbufferPtrs [
1 ] ; real_T * * xBuffer = ( real_T * * ) & _rtDW ->
VariableTransportDelay_PWORK_az . TUbufferPtrs [ 2 ] ; real_T simTime =
ssGetT ( S ) ; real_T appliedDelay ; _rtB -> B_4_7_0 =
SY33_acc_rt_VTDelayfindtDInterpolate ( ( ( X_SY33_T * ) ssGetContStates ( S )
) -> VariableTransportDelay_CSTATE_f , * tBuffer , * uBuffer , * xBuffer ,
_rtDW -> VariableTransportDelay_IWORK_b . CircularBufSize , _rtDW ->
VariableTransportDelay_IWORK_b . Head , _rtDW ->
VariableTransportDelay_IWORK_b . Tail , & _rtDW ->
VariableTransportDelay_IWORK_b . Last , simTime , 0.0 , 0 , ( boolean_T ) (
ssIsMinorTimeStep ( S ) && ( ssGetTimeOfLastOutput ( S ) == ssGetT ( S ) ) )
, _rtP -> P_6 , & appliedDelay ) ; } _rtB -> B_4_8_0 = _rtX ->
integrator_CSTATE_h ; _rtB -> B_4_9_0 = ssGetT ( S ) ; isHit = ssIsSampleHit
( S , 1 , 0 ) ; if ( isHit != 0 ) { if ( ssIsMajorTimeStep ( S ) != 0 ) {
_rtDW -> RelationalOperator_Mode_ei = ( _rtB -> B_4_9_0 >= _rtB -> B_4_1_0_p
) ; } _rtB -> B_4_10_0 = _rtDW -> RelationalOperator_Mode_ei ; _rtB ->
B_4_11_0 = _rtDW -> Memory_PreviousInput_h ; } if ( _rtB -> B_4_10_0 ) { _rtB
-> B_1_0_0 = _rtB -> B_4_8_0 - _rtB -> B_4_7_0 ; _rtB -> B_1_1_0 = _rtB ->
B_1_0_0 * _rtB -> B_9_9_0 ; _rtB -> B_4_13_0 = _rtB -> B_1_1_0 ; } else {
_rtB -> B_4_13_0 = _rtB -> B_4_11_0 ; } _rtB -> B_4_14_0 . re = _rtB ->
B_4_6_0 ; _rtB -> B_4_14_0 . im = _rtB -> B_4_13_0 ; _rtB -> B_4_15_0 =
muDoubleScalarHypot ( _rtB -> B_4_14_0 . re , _rtB -> B_4_14_0 . im ) ; if (
ssIsMajorTimeStep ( S ) != 0 ) { _rtDW -> Saturation_MODE = _rtB -> B_4_15_0
>= _rtP -> P_9 ? 1 : _rtB -> B_4_15_0 > _rtP -> P_10 ? 0 : - 1 ; } _rtB ->
B_4_16_0 = _rtDW -> Saturation_MODE == 1 ? _rtP -> P_9 : _rtDW ->
Saturation_MODE == - 1 ? _rtP -> P_10 : _rtB -> B_4_15_0 ; _rtB -> B_4_17_0 =
1.0 / _rtB -> B_4_16_0 ; if ( _rtB -> B_9_9_0 > _rtP -> P_11 ) { _rtB ->
B_4_18_0 = _rtP -> P_11 ; } else if ( _rtB -> B_9_9_0 < _rtP -> P_12 ) { _rtB
-> B_4_18_0 = _rtP -> P_12 ; } else { _rtB -> B_4_18_0 = _rtB -> B_9_9_0 ; }
_rtB -> B_4_19_0 = 1.0 / _rtB -> B_4_18_0 ; if ( _rtB -> B_9_9_0 > _rtP ->
P_13 ) { _rtB -> B_4_20_0 = _rtP -> P_13 ; } else if ( _rtB -> B_9_9_0 < _rtP
-> P_14 ) { _rtB -> B_4_20_0 = _rtP -> P_14 ; } else { _rtB -> B_4_20_0 =
_rtB -> B_9_9_0 ; } _rtB -> B_4_21_0 = 1.0 / _rtB -> B_4_20_0 ; _rtB ->
B_4_22_0 [ 0 ] = 0.0 ; _rtB -> B_4_22_0 [ 1 ] = 0.0 ; _rtB -> B_4_22_0 [ 2 ]
= 0.0 ; for ( i = 0 ; i < 3 ; i ++ ) { _rtB -> B_4_23_0 [ i ] = 0.0 ; _rtB ->
B_4_23_0 [ i ] += _rtP -> P_15 [ i ] * _rtB -> B_4_22_0 [ 0 ] ; _rtB ->
B_4_23_0 [ i ] += _rtP -> P_15 [ i + 3 ] * _rtB -> B_4_22_0 [ 1 ] ; _rtB ->
B_4_23_0 [ i ] += _rtP -> P_15 [ i + 6 ] * _rtB -> B_4_22_0 [ 2 ] ; _rtB ->
B_4_24_0 [ i ] = _rtP -> P_16 * _rtB -> B_4_23_0 [ i ] ; }
SY33_Subsystempi2delay ( S , _rtB -> B_4_6_0_g , & _rtB -> B_4_24_0 [ 0 ] ,
_rtB -> B_9_7_0 , & _rtB -> Subsystempi2delay_f , & _rtDW ->
Subsystempi2delay_f ) ; SY33_Subsystem1 ( S , _rtB -> B_4_4_0_d , & _rtB ->
B_4_24_0 [ 0 ] , _rtB -> B_9_7_0 , & _rtB -> Subsystem1_a , & _rtDW ->
Subsystem1_a ) ; if ( _rtB -> B_4_4_0_d != 0 ) { _rtB -> B_4_27_0 [ 0 ] =
_rtB -> Subsystem1_a . B_3_0_0 ; _rtB -> B_4_27_0 [ 1 ] = _rtB ->
Subsystem1_a . B_3_1_0 ; } else { _rtB -> B_4_27_0 [ 0 ] = _rtB ->
Subsystempi2delay_f . B_2_0_0 ; _rtB -> B_4_27_0 [ 1 ] = _rtB ->
Subsystempi2delay_f . B_2_1_0 ; } if ( ssIsMajorTimeStep ( S ) != 0 ) {
srUpdateBC ( _rtDW -> AutomaticGainControl_SubsysRanBC ) ; } } if (
ssIsMajorTimeStep ( S ) != 0 ) { if ( _rtX -> Integrator_CSTATE_a >= _rtP ->
P_60 ) { _rtX -> Integrator_CSTATE_a = _rtP -> P_60 ; } else { if ( _rtX ->
Integrator_CSTATE_a <= _rtP -> P_61 ) { _rtX -> Integrator_CSTATE_a = _rtP ->
P_61 ; } } } _rtB -> B_9_11_0 = _rtX -> Integrator_CSTATE_a ; { real_T * *
uBuffer = ( real_T * * ) & _rtDW -> VariableTransportDelay_PWORK .
TUbufferPtrs [ 0 ] ; real_T * * tBuffer = ( real_T * * ) & _rtDW ->
VariableTransportDelay_PWORK . TUbufferPtrs [ 1 ] ; real_T * * xBuffer = (
real_T * * ) & _rtDW -> VariableTransportDelay_PWORK . TUbufferPtrs [ 2 ] ;
real_T simTime = ssGetT ( S ) ; real_T appliedDelay ; _rtB -> B_9_12_0 =
SY33_acc_rt_VTDelayfindtDInterpolate ( ( ( X_SY33_T * ) ssGetContStates ( S )
) -> VariableTransportDelay_CSTATE , * tBuffer , * uBuffer , * xBuffer ,
_rtDW -> VariableTransportDelay_IWORK . CircularBufSize , _rtDW ->
VariableTransportDelay_IWORK . Head , _rtDW -> VariableTransportDelay_IWORK .
Tail , & _rtDW -> VariableTransportDelay_IWORK . Last , simTime , 0.0 , 0 , (
boolean_T ) ( ssIsMinorTimeStep ( S ) && ( ssGetTimeOfLastOutput ( S ) ==
ssGetT ( S ) ) ) , _rtP -> P_63 , & appliedDelay ) ; } _rtB -> B_9_13_0 =
_rtX -> integrator_CSTATE ; _rtB -> B_9_14_0 = ssGetT ( S ) ; isHit =
ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit != 0 ) { if ( ssIsMajorTimeStep ( S
) != 0 ) { _rtDW -> RelationalOperator_Mode_e = ( _rtB -> B_9_14_0 >= _rtB ->
B_9_4_0 ) ; } _rtB -> B_9_15_0_d = _rtDW -> RelationalOperator_Mode_e ; _rtB
-> B_9_16_0 = _rtDW -> Memory_PreviousInput_e ; } if ( _rtB -> B_9_15_0_d ) {
_rtB -> B_5_0_0 = _rtB -> B_9_13_0 - _rtB -> B_9_12_0 ; _rtB -> B_5_1_0 =
_rtB -> B_5_0_0 * _rtB -> B_9_9_0 ; _rtB -> B_9_18_0 = _rtB -> B_5_1_0 ; }
else { _rtB -> B_9_18_0 = _rtB -> B_9_16_0 ; } _rtB -> B_9_19_0 = _rtB ->
B_9_18_0 * _rtB -> B_4_17_0 ; _rtB -> B_9_20_0 = _rtP -> P_66 * _rtB ->
B_9_19_0 ; _rtB -> B_9_21_0 = _rtP -> P_67 * _rtB -> B_9_19_0 ; _rtB ->
B_9_22_0 = _rtP -> P_68 * _rtB -> B_9_19_0 ; _rtB -> B_9_23_0 = 0.0 ; _rtB ->
B_9_23_0 += _rtP -> P_70 * _rtX -> TransferFcn_CSTATE ; _rtB -> B_9_23_0 +=
_rtP -> P_71 * _rtB -> B_9_22_0 ; _rtB -> B_9_24_0 = ( _rtB -> B_9_20_0 +
_rtB -> B_9_11_0 ) + _rtB -> B_9_23_0 ; if ( ssIsMajorTimeStep ( S ) != 0 ) {
_rtDW -> Saturation2_MODE = _rtB -> B_9_24_0 >= _rtP -> P_72 ? 1 : _rtB ->
B_9_24_0 > _rtP -> P_73 ? 0 : - 1 ; } _rtB -> B_9_25_0 = _rtDW ->
Saturation2_MODE == 1 ? _rtP -> P_72 : _rtDW -> Saturation2_MODE == - 1 ?
_rtP -> P_73 : _rtB -> B_9_24_0 ; _rtB -> B_9_26_0 = _rtP -> P_74 * _rtB ->
B_9_25_0 ; if ( ( _rtDW -> LastMajorTimeA >= ssGetTaskTime ( S , 0 ) ) && (
_rtDW -> LastMajorTimeB >= ssGetTaskTime ( S , 0 ) ) ) { _rtB -> B_9_27_0 =
_rtB -> B_9_26_0 ; } else { if ( ( ( _rtDW -> LastMajorTimeA < _rtDW ->
LastMajorTimeB ) && ( _rtDW -> LastMajorTimeB < ssGetTaskTime ( S , 0 ) ) )
|| ( ( _rtDW -> LastMajorTimeA >= _rtDW -> LastMajorTimeB ) && ( _rtDW ->
LastMajorTimeA >= ssGetTaskTime ( S , 0 ) ) ) ) { deltaT = ssGetTaskTime ( S
, 0 ) - _rtDW -> LastMajorTimeB ; pLastY = _rtDW -> PrevYB ; } else { deltaT
= ssGetTaskTime ( S , 0 ) - _rtDW -> LastMajorTimeA ; pLastY = _rtDW ->
PrevYA ; } riseValLimit = deltaT * _rtP -> P_75 ; rateLimiterRate = _rtB ->
B_9_26_0 - pLastY ; if ( rateLimiterRate > riseValLimit ) { _rtB -> B_9_27_0
= pLastY + riseValLimit ; } else { deltaT *= _rtP -> P_76 ; if (
rateLimiterRate < deltaT ) { _rtB -> B_9_27_0 = pLastY + deltaT ; } else {
_rtB -> B_9_27_0 = _rtB -> B_9_26_0 ; } } } _rtB -> B_9_28_0 = _rtX ->
Integrator_x1_CSTATE ; _rtB -> B_9_29_0 = _rtP -> P_78 * _rtB -> B_9_28_0 ;
_rtB -> B_9_30_0 = _rtX -> Integrator_x2_CSTATE ; _rtB -> B_9_31_0 = _rtP ->
P_80 * _rtB -> B_9_30_0 ; _rtB -> B_9_32_0 = _rtP -> P_81 * _rtB -> B_9_28_0
; _rtB -> B_9_33_0 = _rtP -> P_82 * _rtB -> B_9_30_0 ; _rtB -> B_9_34_0 =
_rtB -> B_9_29_0 + _rtB -> B_9_31_0 ; _rtB -> B_9_35_0 = _rtB -> B_9_32_0 +
_rtB -> B_9_33_0 ; _rtB -> B_9_36_0 = _rtP -> P_83 * _rtB -> B_9_27_0 ; _rtB
-> B_9_37_0 = _rtB -> B_9_34_0 + _rtB -> B_9_36_0 ; _rtB -> B_9_38_0 = _rtP
-> P_84 * _rtB -> B_9_27_0 ; _rtB -> B_9_39_0 = _rtB -> B_9_35_0 + _rtB ->
B_9_38_0 ; _rtB -> B_9_44_0 = ( _rtP -> P_85 * _rtB -> B_9_28_0 + _rtP ->
P_86 * _rtB -> B_9_30_0 ) + _rtP -> P_87 * _rtB -> B_9_27_0 ; if ( _rtB ->
B_9_9_0 > _rtP -> P_88 ) { _rtB -> B_9_45_0 = _rtP -> P_88 ; } else if ( _rtB
-> B_9_9_0 < _rtP -> P_89 ) { _rtB -> B_9_45_0 = _rtP -> P_89 ; } else { _rtB
-> B_9_45_0 = _rtB -> B_9_9_0 ; } _rtB -> B_9_46_0 = 1.0 / _rtB -> B_9_45_0 ;
_rtB -> B_9_47_0 [ 0 ] = 0.0 ; _rtB -> B_9_47_0 [ 1 ] = 0.0 ; _rtB ->
B_9_47_0 [ 2 ] = 0.0 ; for ( i = 0 ; i < 3 ; i ++ ) { _rtB -> B_9_48_0 [ i ]
= 0.0 ; _rtB -> B_9_48_0 [ i ] += _rtP -> P_90 [ i ] * _rtB -> B_9_47_0 [ 0 ]
; _rtB -> B_9_48_0 [ i ] += _rtP -> P_90 [ i + 3 ] * _rtB -> B_9_47_0 [ 1 ] ;
_rtB -> B_9_48_0 [ i ] += _rtP -> P_90 [ i + 6 ] * _rtB -> B_9_47_0 [ 2 ] ;
_rtB -> B_9_49_0 [ i ] = _rtP -> P_91 * _rtB -> B_9_48_0 [ i ] ; }
SY33_Subsystempi2delay ( S , _rtB -> B_9_9_0_j , & _rtB -> B_9_49_0 [ 0 ] ,
_rtB -> B_9_7_0 , & _rtB -> Subsystempi2delay , & _rtDW -> Subsystempi2delay
) ; SY33_Subsystem1 ( S , _rtB -> B_9_7_0_l , & _rtB -> B_9_49_0 [ 0 ] , _rtB
-> B_9_7_0 , & _rtB -> Subsystem1 , & _rtDW -> Subsystem1 ) ; if ( _rtB ->
B_9_7_0_l != 0 ) { _rtB -> B_9_52_0 [ 0 ] = _rtB -> Subsystem1 . B_3_0_0 ;
_rtB -> B_9_52_0 [ 1 ] = _rtB -> Subsystem1 . B_3_1_0 ; } else { _rtB ->
B_9_52_0 [ 0 ] = _rtB -> Subsystempi2delay . B_2_0_0 ; _rtB -> B_9_52_0 [ 1 ]
= _rtB -> Subsystempi2delay . B_2_1_0 ; } isHit = ssIsSampleHit ( S , 1 , 0 )
; for ( i = 0 ; i < 6 ; i ++ ) { if ( isHit != 0 ) { _rtB -> B_9_53_0 [ i ] =
_rtP -> P_92 [ i ] ; } rtb_B_9_54_0 [ i ] = _rtB -> B_9_7_0 + _rtB ->
B_9_53_0 [ i ] ; } isHit = ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit != 0 ) {
_rtB -> B_9_55_0 = _rtP -> P_93 ; } for ( i = 0 ; i < 6 ; i ++ ) { deltaT =
muDoubleScalarMod ( rtb_B_9_54_0 [ i ] , _rtB -> B_9_55_0 ) ; _rtB ->
B_9_57_0 [ i ] = _rtP -> P_94 * deltaT ; rtb_B_9_54_0 [ i ] = deltaT ; }
isHit = ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit != 0 ) { if (
ssIsMajorTimeStep ( S ) != 0 ) { for ( i = 0 ; i < 6 ; i ++ ) { _rtDW ->
RelationalOperator2_Mode [ i ] = ( _rtB -> B_9_57_0 [ i ] >= _rtB ->
B_9_0_0_m ) ; } } for ( i = 0 ; i < 6 ; i ++ ) { _rtB -> B_9_59_0 [ i ] = !
_rtDW -> RelationalOperator2_Mode [ i ] ; } } isHit = ssIsSampleHit ( S , 1 ,
0 ) ; for ( i = 0 ; i < 6 ; i ++ ) { if ( isHit != 0 ) { _rtB -> B_9_61_0 [ i
] = _rtDW -> ICic_PreviousInput [ i ] ; } if ( _rtB -> B_9_59_0 [ i ] ) {
_rtB -> B_9_62_0 [ i ] = _rtB -> B_9_0_0_m ; } else { _rtB -> B_9_62_0 [ i ]
= _rtB -> B_9_61_0 [ i ] ; } rtb_B_9_60_0 [ i ] = _rtB -> B_9_59_0 [ i ] ; }
isHit = ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit != 0 ) { _rtB -> B_9_63_0 =
_rtP -> P_96 ; } for ( i = 0 ; i < 6 ; i ++ ) { _rtB -> B_9_64_0 [ i ] = _rtB
-> B_9_62_0 [ i ] + _rtB -> B_9_63_0 ; } isHit = ssIsSampleHit ( S , 1 , 0 )
; if ( ( isHit != 0 ) && ( ssIsMajorTimeStep ( S ) != 0 ) ) { for ( i = 0 ; i
< 6 ; i ++ ) { _rtDW -> RelationalOperator4_Mode [ i ] = ( _rtB -> B_9_57_0 [
i ] <= _rtB -> B_9_64_0 [ i ] ) ; } } _rtB -> B_9_90_0 = _rtP -> P_97 * _rtB
-> B_9_3_0 [ 0 ] ; _rtB -> B_9_91_0 = _rtP -> P_98 * _rtB -> B_9_90_0 ; _rtB
-> B_9_92_0 = _rtP -> P_99 * _rtB -> B_9_3_0 [ 1 ] ; _rtB -> B_9_93_0 = _rtP
-> P_100 * _rtB -> B_9_3_0 [ 2 ] ; _rtB -> B_9_94_0 = _rtP -> P_101 * _rtB ->
B_9_93_0 ; _rtB -> B_9_95_0 = _rtP -> P_102 * _rtB -> B_9_92_0 ; isHit =
ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit != 0 ) { zcEvent [ 0 ] = rt_ZCFcn (
RISING_ZERO_CROSSING , & _rtZCE -> HitCrossing_Input_ZCE [ 0 ] , _rtB ->
B_9_91_0 - _rtP -> P_103 ) ; zcEvent [ 1 ] = rt_ZCFcn ( RISING_ZERO_CROSSING
, & _rtZCE -> HitCrossing_Input_ZCE [ 1 ] , _rtB -> B_9_92_0 - _rtP -> P_103
) ; zcEvent [ 2 ] = rt_ZCFcn ( RISING_ZERO_CROSSING , & _rtZCE ->
HitCrossing_Input_ZCE [ 2 ] , _rtB -> B_9_94_0 - _rtP -> P_103 ) ; zcEvent [
3 ] = rt_ZCFcn ( RISING_ZERO_CROSSING , & _rtZCE -> HitCrossing_Input_ZCE [ 3
] , _rtB -> B_9_90_0 - _rtP -> P_103 ) ; zcEvent [ 4 ] = rt_ZCFcn (
RISING_ZERO_CROSSING , & _rtZCE -> HitCrossing_Input_ZCE [ 4 ] , _rtB ->
B_9_95_0 - _rtP -> P_103 ) ; zcEvent [ 5 ] = rt_ZCFcn ( RISING_ZERO_CROSSING
, & _rtZCE -> HitCrossing_Input_ZCE [ 5 ] , _rtB -> B_9_93_0 - _rtP -> P_103
) ; rtb_B_9_60_0 [ 0 ] = ( _rtB -> B_9_91_0 != _rtP -> P_103 ) ; rtb_B_9_60_0
[ 1 ] = ( _rtB -> B_9_92_0 != _rtP -> P_103 ) ; rtb_B_9_60_0 [ 2 ] = ( _rtB
-> B_9_94_0 != _rtP -> P_103 ) ; rtb_B_9_60_0 [ 3 ] = ( _rtB -> B_9_90_0 !=
_rtP -> P_103 ) ; rtb_B_9_60_0 [ 4 ] = ( _rtB -> B_9_95_0 != _rtP -> P_103 )
; rtb_B_9_60_0 [ 5 ] = ( _rtB -> B_9_93_0 != _rtP -> P_103 ) ; tmp [ 0 ] = (
_rtB -> B_9_91_0 != _rtP -> P_103 ) ; tmp [ 1 ] = ( _rtB -> B_9_92_0 != _rtP
-> P_103 ) ; tmp [ 2 ] = ( _rtB -> B_9_94_0 != _rtP -> P_103 ) ; tmp [ 3 ] =
( _rtB -> B_9_90_0 != _rtP -> P_103 ) ; tmp [ 4 ] = ( _rtB -> B_9_95_0 !=
_rtP -> P_103 ) ; tmp [ 5 ] = ( _rtB -> B_9_93_0 != _rtP -> P_103 ) ; for ( i
= 0 ; i < 6 ; i ++ ) { if ( _rtDW -> HitCrossing_MODE [ i ] == 0 ) { if (
zcEvent [ i ] != NO_ZCEVENT ) { _rtB -> B_9_96_0 [ i ] = ! _rtB -> B_9_96_0 [
i ] ; _rtDW -> HitCrossing_MODE [ i ] = 1 ; } else { if ( _rtB -> B_9_96_0 [
i ] && tmp [ i ] ) { _rtB -> B_9_96_0 [ i ] = false ; } } } else { if (
rtb_B_9_60_0 [ i ] ) { _rtB -> B_9_96_0 [ i ] = false ; } _rtDW ->
HitCrossing_MODE [ i ] = 0 ; } } } if ( ssIsMajorTimeStep ( S ) != 0 ) {
resetSolver = false ; for ( i = 0 ; i < 6 ; i ++ ) { didZcEventOccur = ( _rtB
-> B_9_96_0 [ i ] && ( _rtZCE -> Integrator1_Reset_ZCE [ i ] != POS_ZCSIG ) )
; _rtZCE -> Integrator1_Reset_ZCE [ i ] = _rtB -> B_9_96_0 [ i ] ; if (
didZcEventOccur ) { resetSolver = true ; _rtX -> Integrator1_CSTATE [ i ] =
_rtP -> P_104 ; } } if ( resetSolver ) {
ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; } } for ( i = 0 ; i < 6 ;
i ++ ) { _rtB -> B_9_97_0 [ i ] = _rtX -> Integrator1_CSTATE [ i ] ; } isHit
= ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit != 0 ) { if ( ssIsMajorTimeStep (
S ) != 0 ) { for ( i = 0 ; i < 6 ; i ++ ) { _rtDW -> RelationalOperator1_Mode
[ i ] = ( _rtB -> B_9_97_0 [ i ] > _rtB -> B_9_23_0_g ) ; } } isHit = (
int32_T ) ( ( ( ( ( uint32_T ) _rtDW -> Memory_PreviousInput_bf [ 0 ] << 1 )
+ _rtB -> B_9_96_0 [ 0 ] ) << 1 ) + _rtDW -> Memory_PreviousInput_o ) ; _rtB
-> B_9_101_0 [ 0U ] = _rtP -> P_136 [ ( uint32_T ) isHit ] ; _rtB ->
B_9_101_0 [ 1U ] = _rtP -> P_136 [ isHit + 8U ] ; isHit = ( int32_T ) ( ( ( (
( uint32_T ) _rtDW -> Memory_PreviousInput_bf [ 1 ] << 1 ) + _rtB -> B_9_96_0
[ 1 ] ) << 1 ) + _rtDW -> Memory_PreviousInput_m ) ; _rtB -> B_9_103_0 [ 0U ]
= _rtP -> P_138 [ ( uint32_T ) isHit ] ; _rtB -> B_9_103_0 [ 1U ] = _rtP ->
P_138 [ isHit + 8U ] ; isHit = ( int32_T ) ( ( ( ( ( uint32_T ) _rtDW ->
Memory_PreviousInput_bf [ 2 ] << 1 ) + _rtB -> B_9_96_0 [ 2 ] ) << 1 ) +
_rtDW -> Memory_PreviousInput_or ) ; _rtB -> B_9_105_0 [ 0U ] = _rtP -> P_140
[ ( uint32_T ) isHit ] ; _rtB -> B_9_105_0 [ 1U ] = _rtP -> P_140 [ isHit +
8U ] ; isHit = ( int32_T ) ( ( ( ( ( uint32_T ) _rtDW ->
Memory_PreviousInput_bf [ 3 ] << 1 ) + _rtB -> B_9_96_0 [ 3 ] ) << 1 ) +
_rtDW -> Memory_PreviousInput_k ) ; _rtB -> B_9_107_0 [ 0U ] = _rtP -> P_142
[ ( uint32_T ) isHit ] ; _rtB -> B_9_107_0 [ 1U ] = _rtP -> P_142 [ isHit +
8U ] ; isHit = ( int32_T ) ( ( ( ( ( uint32_T ) _rtDW ->
Memory_PreviousInput_bf [ 4 ] << 1 ) + _rtB -> B_9_96_0 [ 4 ] ) << 1 ) +
_rtDW -> Memory_PreviousInput_j ) ; _rtB -> B_9_109_0 [ 0U ] = _rtP -> P_144
[ ( uint32_T ) isHit ] ; _rtB -> B_9_109_0 [ 1U ] = _rtP -> P_144 [ isHit +
8U ] ; isHit = ( int32_T ) ( ( ( ( ( uint32_T ) _rtDW ->
Memory_PreviousInput_bf [ 5 ] << 1 ) + _rtB -> B_9_96_0 [ 5 ] ) << 1 ) +
_rtDW -> Memory_PreviousInput_ka ) ; _rtB -> B_9_111_0 [ 0U ] = _rtP -> P_146
[ ( uint32_T ) isHit ] ; _rtB -> B_9_111_0 [ 1U ] = _rtP -> P_146 [ isHit +
8U ] ; _rtB -> B_9_113_0 [ 0 ] = ( _rtDW -> RelationalOperator1_Mode [ 0 ] &&
( ! _rtB -> B_9_101_0 [ 0 ] ) ) ; _rtB -> B_9_113_0 [ 1 ] = ( _rtDW ->
RelationalOperator1_Mode [ 1 ] && ( ! _rtB -> B_9_103_0 [ 0 ] ) ) ; _rtB ->
B_9_113_0 [ 2 ] = ( _rtDW -> RelationalOperator1_Mode [ 2 ] && ( ! _rtB ->
B_9_105_0 [ 0 ] ) ) ; _rtB -> B_9_113_0 [ 3 ] = ( _rtDW ->
RelationalOperator1_Mode [ 3 ] && ( ! _rtB -> B_9_107_0 [ 0 ] ) ) ; _rtB ->
B_9_113_0 [ 4 ] = ( _rtDW -> RelationalOperator1_Mode [ 4 ] && ( ! _rtB ->
B_9_109_0 [ 0 ] ) ) ; _rtB -> B_9_113_0 [ 5 ] = ( _rtDW ->
RelationalOperator1_Mode [ 5 ] && ( ! _rtB -> B_9_111_0 [ 0 ] ) ) ; } if (
ssIsMajorTimeStep ( S ) != 0 ) { resetSolver = false ; for ( i = 0 ; i < 6 ;
i ++ ) { didZcEventOccur = ( _rtB -> B_9_113_0 [ i ] && ( _rtZCE ->
Integrator2_Reset_ZCE [ i ] != POS_ZCSIG ) ) ; _rtZCE ->
Integrator2_Reset_ZCE [ i ] = _rtB -> B_9_113_0 [ i ] ; if ( didZcEventOccur
) { resetSolver = true ; _rtX -> Integrator2_CSTATE [ i ] = _rtP -> P_105 ; }
} if ( resetSolver ) { ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; } }
for ( i = 0 ; i < 6 ; i ++ ) { _rtB -> B_9_114_0 [ i ] = _rtX ->
Integrator2_CSTATE [ i ] ; } isHit = ssIsSampleHit ( S , 1 , 0 ) ; if ( isHit
!= 0 ) { if ( ssIsMajorTimeStep ( S ) != 0 ) { for ( i = 0 ; i < 6 ; i ++ ) {
_rtDW -> RelationalOperator2_Mode_i [ i ] = ( _rtB -> B_9_114_0 [ i ] < _rtB
-> B_9_24_0_m ) ; } } for ( i = 0 ; i < 6 ; i ++ ) { _rtB -> B_9_116_0 [ i ]
= ( _rtDW -> RelationalOperator2_Mode_i [ i ] && _rtB -> B_9_21_0_d ) ; } if
( _rtB -> B_9_20_0_g >= _rtP -> P_106 ) { for ( i = 0 ; i < 5 ; i ++ ) {
rtb_B_9_60_0 [ i ] = ( _rtB -> B_9_116_0 [ i ] || _rtB -> B_9_116_0 [ i + 1 ]
) ; } rtb_B_9_60_0 [ 5 ] = ( _rtB -> B_9_116_0 [ 5 ] || _rtB -> B_9_116_0 [ 0
] ) ; } else { for ( i = 0 ; i < 6 ; i ++ ) { rtb_B_9_60_0 [ i ] = _rtB ->
B_9_116_0 [ i ] ; } } for ( i = 0 ; i < 6 ; i ++ ) { _rtB -> B_9_120_0 [ i ]
= _rtP -> P_107 * ( real_T ) rtb_B_9_60_0 [ i ] ; } } _rtB -> B_9_133_0 [ 0 ]
= _rtP -> P_108 * _rtB -> B_9_3_0 [ 4 ] * _rtP -> P_111 ; _rtB -> B_9_133_0 [
1 ] = _rtP -> P_109 * _rtB -> B_9_3_0 [ 6 ] * _rtP -> P_111 ; _rtB ->
B_9_133_0 [ 2 ] = _rtP -> P_110 * _rtB -> B_9_3_0 [ 5 ] * _rtP -> P_111 ;
_rtB -> B_9_134_0 = _rtP -> P_112 * _rtB -> B_9_3_0 [ 7 ] ; _rtB -> B_9_135_0
= _rtP -> P_113 * _rtB -> B_9_3_0 [ 3 ] ; ssCallAccelRunBlock ( S , 9 , 136 ,
SS_CALL_MDL_OUTPUTS ) ; UNUSED_PARAMETER ( tid ) ; } static void
mdlOutputsTID2 ( SimStruct * S , int_T tid ) { B_SY33_T * _rtB ; P_SY33_T *
_rtP ; DW_SY33_T * _rtDW ; _rtDW = ( ( DW_SY33_T * ) ssGetRootDWork ( S ) ) ;
_rtP = ( ( P_SY33_T * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( B_SY33_T * )
_ssGetModelBlockIO ( S ) ) ; _rtB -> B_9_0_0_m = _rtP -> P_114 ; _rtB ->
B_4_0_0_n = _rtP -> P_17 ; _rtB -> B_4_1_0_p = _rtP -> P_18 ; _rtB ->
B_4_4_0_d = ( uint8_T ) ( _rtP -> P_19 == _rtP -> P_20 ) ; _rtB -> B_4_6_0_g
= ( uint8_T ) ( _rtP -> P_19 == _rtP -> P_21 ) ; if ( ssIsMajorTimeStep ( S )
!= 0 ) { srUpdateBC ( _rtDW -> AutomaticGainControl_SubsysRanBC ) ; } _rtB ->
B_9_2_0_c = _rtP -> P_115 ; _rtB -> B_9_3_0_k = _rtP -> P_116 ; _rtB ->
B_9_4_0 = _rtP -> P_117 ; _rtB -> B_9_7_0_l = ( uint8_T ) ( _rtP -> P_118 ==
_rtP -> P_119 ) ; _rtB -> B_9_9_0_j = ( uint8_T ) ( _rtP -> P_118 == _rtP ->
P_120 ) ; _rtB -> B_9_10_0 = _rtP -> P_121 ; _rtB -> B_9_11_0_c = _rtP ->
P_122 ; _rtB -> B_9_12_0_b = _rtP -> P_123 ; _rtB -> B_9_13_0_p = _rtP ->
P_124 ; _rtB -> B_9_14_0_c = _rtP -> P_125 ; _rtB -> B_9_15_0 = _rtP -> P_126
; _rtB -> B_9_19_0_f = _rtP -> P_129 ; _rtB -> B_9_20_0_g = _rtP -> P_130 ;
_rtB -> B_9_21_0_d = ! ( _rtP -> P_128 != 0.0 ) ; _rtB -> B_9_23_0_g = _rtP
-> P_132 * _rtP -> P_127 ; _rtB -> B_9_24_0_m = _rtP -> P_133 * _rtP -> P_131
; UNUSED_PARAMETER ( tid ) ; }
#define MDL_UPDATE
static void mdlUpdate ( SimStruct * S , int_T tid ) { int32_T i ; B_SY33_T *
_rtB ; P_SY33_T * _rtP ; X_SY33_T * _rtX ; DW_SY33_T * _rtDW ; _rtDW = ( (
DW_SY33_T * ) ssGetRootDWork ( S ) ) ; _rtX = ( ( X_SY33_T * )
ssGetContStates ( S ) ) ; _rtP = ( ( P_SY33_T * ) ssGetModelRtp ( S ) ) ;
_rtB = ( ( B_SY33_T * ) _ssGetModelBlockIO ( S ) ) ; ssCallAccelRunBlock ( S
, 9 , 3 , SS_CALL_MDL_UPDATE ) ; _rtDW -> Integrator_IWORK = 0 ; if ( _rtX ->
Integrator_CSTATE == _rtP -> P_55 ) { switch ( _rtDW -> Integrator_MODE ) {
case 3 : if ( _rtB -> B_9_25_0 < 0.0 ) {
ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; _rtDW -> Integrator_MODE =
1 ; } break ; case 1 : if ( _rtB -> B_9_25_0 >= 0.0 ) { _rtDW ->
Integrator_MODE = 3 ; ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; }
break ; default : ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; if (
_rtB -> B_9_25_0 < 0.0 ) { _rtDW -> Integrator_MODE = 1 ; } else { _rtDW ->
Integrator_MODE = 3 ; } break ; } } else if ( _rtX -> Integrator_CSTATE ==
_rtP -> P_56 ) { switch ( _rtDW -> Integrator_MODE ) { case 4 : if ( _rtB ->
B_9_25_0 > 0.0 ) { ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; _rtDW
-> Integrator_MODE = 2 ; } break ; case 2 : if ( _rtB -> B_9_25_0 <= 0.0 ) {
_rtDW -> Integrator_MODE = 4 ; ssSetBlockStateForSolverChangedAtMajorStep ( S
) ; } break ; default : ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; if
( _rtB -> B_9_25_0 > 0.0 ) { _rtDW -> Integrator_MODE = 2 ; } else { _rtDW ->
Integrator_MODE = 4 ; } break ; } } else { _rtDW -> Integrator_MODE = 0 ; } i
= ssIsSampleHit ( S , 1 , 0 ) ; if ( i != 0 ) { _rtDW -> Memory_PreviousInput
= _rtB -> B_9_44_0 ; } if ( _rtDW -> AutomaticGainControl_MODE ) { { real_T *
* uBuffer = ( real_T * * ) & _rtDW -> VariableTransportDelay_PWORK_a .
TUbufferPtrs [ 0 ] ; real_T * * tBuffer = ( real_T * * ) & _rtDW ->
VariableTransportDelay_PWORK_a . TUbufferPtrs [ 1 ] ; real_T * * xBuffer = (
real_T * * ) & _rtDW -> VariableTransportDelay_PWORK_a . TUbufferPtrs [ 2 ] ;
real_T simTime = ssGetT ( S ) ; _rtDW -> VariableTransportDelay_IWORK_e .
Head = ( ( _rtDW -> VariableTransportDelay_IWORK_e . Head < ( _rtDW ->
VariableTransportDelay_IWORK_e . CircularBufSize - 1 ) ) ? ( _rtDW ->
VariableTransportDelay_IWORK_e . Head + 1 ) : 0 ) ; if ( _rtDW ->
VariableTransportDelay_IWORK_e . Head == _rtDW ->
VariableTransportDelay_IWORK_e . Tail ) { if ( !
SY33_acc_rt_TDelayUpdateTailOrGrowBuf ( & _rtDW ->
VariableTransportDelay_IWORK_e . CircularBufSize , & _rtDW ->
VariableTransportDelay_IWORK_e . Tail , & _rtDW ->
VariableTransportDelay_IWORK_e . Head , & _rtDW ->
VariableTransportDelay_IWORK_e . Last , simTime - _rtP -> P_1 , tBuffer ,
uBuffer , xBuffer , ( boolean_T ) 0 , ( boolean_T ) 1 , & _rtDW ->
VariableTransportDelay_IWORK_e . MaxNewBufSize ) ) { ssSetErrorStatus ( S ,
"vtdelay memory allocation error" ) ; return ; } } ( * tBuffer ) [ _rtDW ->
VariableTransportDelay_IWORK_e . Head ] = simTime ; ( * uBuffer ) [ _rtDW ->
VariableTransportDelay_IWORK_e . Head ] = _rtB -> B_4_1_0 ; ( * xBuffer ) [
_rtDW -> VariableTransportDelay_IWORK_e . Head ] = ( ( X_SY33_T * )
ssGetContStates ( S ) ) -> VariableTransportDelay_CSTATE_o ; } i =
ssIsSampleHit ( S , 1 , 0 ) ; if ( i != 0 ) { _rtDW -> Memory_PreviousInput_b
= _rtB -> B_4_6_0 ; } { real_T * * uBuffer = ( real_T * * ) & _rtDW ->
VariableTransportDelay_PWORK_az . TUbufferPtrs [ 0 ] ; real_T * * tBuffer = (
real_T * * ) & _rtDW -> VariableTransportDelay_PWORK_az . TUbufferPtrs [ 1 ]
; real_T * * xBuffer = ( real_T * * ) & _rtDW ->
VariableTransportDelay_PWORK_az . TUbufferPtrs [ 2 ] ; real_T simTime =
ssGetT ( S ) ; _rtDW -> VariableTransportDelay_IWORK_b . Head = ( ( _rtDW ->
VariableTransportDelay_IWORK_b . Head < ( _rtDW ->
VariableTransportDelay_IWORK_b . CircularBufSize - 1 ) ) ? ( _rtDW ->
VariableTransportDelay_IWORK_b . Head + 1 ) : 0 ) ; if ( _rtDW ->
VariableTransportDelay_IWORK_b . Head == _rtDW ->
VariableTransportDelay_IWORK_b . Tail ) { if ( !
SY33_acc_rt_TDelayUpdateTailOrGrowBuf ( & _rtDW ->
VariableTransportDelay_IWORK_b . CircularBufSize , & _rtDW ->
VariableTransportDelay_IWORK_b . Tail , & _rtDW ->
VariableTransportDelay_IWORK_b . Head , & _rtDW ->
VariableTransportDelay_IWORK_b . Last , simTime - _rtP -> P_5 , tBuffer ,
uBuffer , xBuffer , ( boolean_T ) 0 , ( boolean_T ) 1 , & _rtDW ->
VariableTransportDelay_IWORK_b . MaxNewBufSize ) ) { ssSetErrorStatus ( S ,
"vtdelay memory allocation error" ) ; return ; } } ( * tBuffer ) [ _rtDW ->
VariableTransportDelay_IWORK_b . Head ] = simTime ; ( * uBuffer ) [ _rtDW ->
VariableTransportDelay_IWORK_b . Head ] = _rtB -> B_4_8_0 ; ( * xBuffer ) [
_rtDW -> VariableTransportDelay_IWORK_b . Head ] = ( ( X_SY33_T * )
ssGetContStates ( S ) ) -> VariableTransportDelay_CSTATE_f ; } i =
ssIsSampleHit ( S , 1 , 0 ) ; if ( i != 0 ) { _rtDW -> Memory_PreviousInput_h
= _rtB -> B_4_13_0 ; } } if ( _rtX -> Integrator_CSTATE_a == _rtP -> P_60 ) {
switch ( _rtDW -> Integrator_MODE_o ) { case 3 : if ( _rtB -> B_9_21_0 < 0.0
) { ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; _rtDW ->
Integrator_MODE_o = 1 ; } break ; case 1 : if ( _rtB -> B_9_21_0 >= 0.0 ) {
_rtDW -> Integrator_MODE_o = 3 ; ssSetBlockStateForSolverChangedAtMajorStep (
S ) ; } break ; default : ssSetBlockStateForSolverChangedAtMajorStep ( S ) ;
if ( _rtB -> B_9_21_0 < 0.0 ) { _rtDW -> Integrator_MODE_o = 1 ; } else {
_rtDW -> Integrator_MODE_o = 3 ; } break ; } } else if ( _rtX ->
Integrator_CSTATE_a == _rtP -> P_61 ) { switch ( _rtDW -> Integrator_MODE_o )
{ case 4 : if ( _rtB -> B_9_21_0 > 0.0 ) {
ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; _rtDW -> Integrator_MODE_o
= 2 ; } break ; case 2 : if ( _rtB -> B_9_21_0 <= 0.0 ) { _rtDW ->
Integrator_MODE_o = 4 ; ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; }
break ; default : ssSetBlockStateForSolverChangedAtMajorStep ( S ) ; if (
_rtB -> B_9_21_0 > 0.0 ) { _rtDW -> Integrator_MODE_o = 2 ; } else { _rtDW ->
Integrator_MODE_o = 4 ; } break ; } } else { _rtDW -> Integrator_MODE_o = 0 ;
} { real_T * * uBuffer = ( real_T * * ) & _rtDW ->
VariableTransportDelay_PWORK . TUbufferPtrs [ 0 ] ; real_T * * tBuffer = (
real_T * * ) & _rtDW -> VariableTransportDelay_PWORK . TUbufferPtrs [ 1 ] ;
real_T * * xBuffer = ( real_T * * ) & _rtDW -> VariableTransportDelay_PWORK .
TUbufferPtrs [ 2 ] ; real_T simTime = ssGetT ( S ) ; _rtDW ->
VariableTransportDelay_IWORK . Head = ( ( _rtDW ->
VariableTransportDelay_IWORK . Head < ( _rtDW -> VariableTransportDelay_IWORK
. CircularBufSize - 1 ) ) ? ( _rtDW -> VariableTransportDelay_IWORK . Head +
1 ) : 0 ) ; if ( _rtDW -> VariableTransportDelay_IWORK . Head == _rtDW ->
VariableTransportDelay_IWORK . Tail ) { if ( !
SY33_acc_rt_TDelayUpdateTailOrGrowBuf ( & _rtDW ->
VariableTransportDelay_IWORK . CircularBufSize , & _rtDW ->
VariableTransportDelay_IWORK . Tail , & _rtDW -> VariableTransportDelay_IWORK
. Head , & _rtDW -> VariableTransportDelay_IWORK . Last , simTime - _rtP ->
P_62 , tBuffer , uBuffer , xBuffer , ( boolean_T ) 0 , ( boolean_T ) 1 , &
_rtDW -> VariableTransportDelay_IWORK . MaxNewBufSize ) ) { ssSetErrorStatus
( S , "vtdelay memory allocation error" ) ; return ; } } ( * tBuffer ) [
_rtDW -> VariableTransportDelay_IWORK . Head ] = simTime ; ( * uBuffer ) [
_rtDW -> VariableTransportDelay_IWORK . Head ] = _rtB -> B_9_13_0 ; ( *
xBuffer ) [ _rtDW -> VariableTransportDelay_IWORK . Head ] = ( ( X_SY33_T * )
ssGetContStates ( S ) ) -> VariableTransportDelay_CSTATE ; } i =
ssIsSampleHit ( S , 1 , 0 ) ; if ( i != 0 ) { _rtDW -> Memory_PreviousInput_e
= _rtB -> B_9_18_0 ; } if ( _rtDW -> LastMajorTimeA == ( rtInf ) ) { _rtDW ->
LastMajorTimeA = ssGetTaskTime ( S , 0 ) ; _rtDW -> PrevYA = _rtB -> B_9_27_0
; } else if ( _rtDW -> LastMajorTimeB == ( rtInf ) ) { _rtDW ->
LastMajorTimeB = ssGetTaskTime ( S , 0 ) ; _rtDW -> PrevYB = _rtB -> B_9_27_0
; } else if ( _rtDW -> LastMajorTimeA < _rtDW -> LastMajorTimeB ) { _rtDW ->
LastMajorTimeA = ssGetTaskTime ( S , 0 ) ; _rtDW -> PrevYA = _rtB -> B_9_27_0
; } else { _rtDW -> LastMajorTimeB = ssGetTaskTime ( S , 0 ) ; _rtDW ->
PrevYB = _rtB -> B_9_27_0 ; } i = ssIsSampleHit ( S , 1 , 0 ) ; if ( i != 0 )
{ for ( i = 0 ; i < 6 ; i ++ ) { _rtDW -> ICic_PreviousInput [ i ] = _rtB ->
B_9_62_0 [ i ] ; _rtDW -> Memory_PreviousInput_bf [ i ] = _rtB -> B_9_116_0 [
i ] ; } _rtDW -> Memory_PreviousInput_o = _rtB -> B_9_101_0 [ 0 ] ; _rtDW ->
Memory_PreviousInput_m = _rtB -> B_9_103_0 [ 0 ] ; _rtDW ->
Memory_PreviousInput_or = _rtB -> B_9_105_0 [ 0 ] ; _rtDW ->
Memory_PreviousInput_k = _rtB -> B_9_107_0 [ 0 ] ; _rtDW ->
Memory_PreviousInput_j = _rtB -> B_9_109_0 [ 0 ] ; _rtDW ->
Memory_PreviousInput_ka = _rtB -> B_9_111_0 [ 0 ] ; } UNUSED_PARAMETER ( tid
) ; }
#define MDL_UPDATE
static void mdlUpdateTID2 ( SimStruct * S , int_T tid ) { UNUSED_PARAMETER (
tid ) ; }
#define MDL_DERIVATIVES
static void mdlDerivatives ( SimStruct * S ) { int32_T i ; B_SY33_T * _rtB ;
P_SY33_T * _rtP ; X_SY33_T * _rtX ; XDot_SY33_T * _rtXdot ; XDis_SY33_T *
_rtXdis ; DW_SY33_T * _rtDW ; _rtDW = ( ( DW_SY33_T * ) ssGetRootDWork ( S )
) ; _rtXdis = ( ( XDis_SY33_T * ) ssGetContStateDisabled ( S ) ) ; _rtXdot =
( ( XDot_SY33_T * ) ssGetdX ( S ) ) ; _rtX = ( ( X_SY33_T * ) ssGetContStates
( S ) ) ; _rtP = ( ( P_SY33_T * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( B_SY33_T
* ) _ssGetModelBlockIO ( S ) ) ; ssCallAccelRunBlock ( S , 9 , 3 ,
SS_CALL_MDL_DERIVATIVES ) ; if ( ( _rtDW -> Integrator_MODE != 3 ) && ( _rtDW
-> Integrator_MODE != 4 ) ) { _rtXdot -> Integrator_CSTATE = _rtB -> B_9_25_0
; _rtXdis -> Integrator_CSTATE = false ; } else { _rtXdot ->
Integrator_CSTATE = 0.0 ; _rtXdis -> Integrator_CSTATE = ( ( _rtDW ->
Integrator_MODE == 3 ) || ( _rtDW -> Integrator_MODE == 4 ) || _rtXdis ->
Integrator_CSTATE ) ; } if ( _rtDW -> AutomaticGainControl_MODE ) { { real_T
instantDelay ; instantDelay = _rtB -> B_4_19_0 ; if ( instantDelay > _rtP ->
P_1 ) { instantDelay = _rtP -> P_1 ; } if ( instantDelay < 0.0 ) { ( (
XDot_SY33_T * ) ssGetdX ( S ) ) -> VariableTransportDelay_CSTATE_o = 0 ; }
else { ( ( XDot_SY33_T * ) ssGetdX ( S ) ) -> VariableTransportDelay_CSTATE_o
= 1.0 / instantDelay ; } } _rtXdot -> integrator_CSTATE_n = _rtB -> B_4_27_0
[ 0 ] ; { real_T instantDelay ; instantDelay = _rtB -> B_4_21_0 ; if (
instantDelay > _rtP -> P_5 ) { instantDelay = _rtP -> P_5 ; } if (
instantDelay < 0.0 ) { ( ( XDot_SY33_T * ) ssGetdX ( S ) ) ->
VariableTransportDelay_CSTATE_f = 0 ; } else { ( ( XDot_SY33_T * ) ssGetdX (
S ) ) -> VariableTransportDelay_CSTATE_f = 1.0 / instantDelay ; } } _rtXdot
-> integrator_CSTATE_h = _rtB -> B_4_27_0 [ 1 ] ; } else { { real_T * dx ;
int_T i ; dx = & ( ( ( XDot_SY33_T * ) ssGetdX ( S ) ) ->
VariableTransportDelay_CSTATE_o ) ; for ( i = 0 ; i < 4 ; i ++ ) { dx [ i ] =
0.0 ; } } } if ( ( _rtDW -> Integrator_MODE_o != 3 ) && ( _rtDW ->
Integrator_MODE_o != 4 ) ) { _rtXdot -> Integrator_CSTATE_a = _rtB ->
B_9_21_0 ; _rtXdis -> Integrator_CSTATE_a = false ; } else { _rtXdot ->
Integrator_CSTATE_a = 0.0 ; _rtXdis -> Integrator_CSTATE_a = ( ( _rtDW ->
Integrator_MODE_o == 3 ) || ( _rtDW -> Integrator_MODE_o == 4 ) || _rtXdis ->
Integrator_CSTATE_a ) ; } { real_T instantDelay ; instantDelay = _rtB ->
B_9_46_0 ; if ( instantDelay > _rtP -> P_62 ) { instantDelay = _rtP -> P_62 ;
} if ( instantDelay < 0.0 ) { ( ( XDot_SY33_T * ) ssGetdX ( S ) ) ->
VariableTransportDelay_CSTATE = 0 ; } else { ( ( XDot_SY33_T * ) ssGetdX ( S
) ) -> VariableTransportDelay_CSTATE = 1.0 / instantDelay ; } } _rtXdot ->
integrator_CSTATE = _rtB -> B_9_52_0 [ 1 ] ; _rtXdot -> TransferFcn_CSTATE =
0.0 ; _rtXdot -> TransferFcn_CSTATE += _rtP -> P_69 * _rtX ->
TransferFcn_CSTATE ; _rtXdot -> TransferFcn_CSTATE += _rtB -> B_9_22_0 ;
_rtXdot -> Integrator_x1_CSTATE = _rtB -> B_9_37_0 ; _rtXdot ->
Integrator_x2_CSTATE = _rtB -> B_9_39_0 ; for ( i = 0 ; i < 6 ; i ++ ) {
_rtXdot -> Integrator1_CSTATE [ i ] = _rtB -> B_9_19_0_f ; _rtXdot ->
Integrator2_CSTATE [ i ] = _rtB -> B_9_19_0_f ; } }
#define MDL_PROJECTION
static void mdlProjection ( SimStruct * S ) { B_SY33_T * _rtB ; P_SY33_T *
_rtP ; DW_SY33_T * _rtDW ; _rtDW = ( ( DW_SY33_T * ) ssGetRootDWork ( S ) ) ;
_rtP = ( ( P_SY33_T * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( B_SY33_T * )
_ssGetModelBlockIO ( S ) ) ; ssCallAccelRunBlock ( S , 9 , 3 ,
SS_CALL_MDL_PROJECTION ) ; }
#define MDL_ZERO_CROSSINGS
static void mdlZeroCrossings ( SimStruct * S ) { int32_T i ; B_SY33_T * _rtB
; P_SY33_T * _rtP ; X_SY33_T * _rtX ; ZCV_SY33_T * _rtZCSV ; DW_SY33_T *
_rtDW ; _rtDW = ( ( DW_SY33_T * ) ssGetRootDWork ( S ) ) ; _rtZCSV = ( (
ZCV_SY33_T * ) ssGetSolverZcSignalVector ( S ) ) ; _rtX = ( ( X_SY33_T * )
ssGetContStates ( S ) ) ; _rtP = ( ( P_SY33_T * ) ssGetModelRtp ( S ) ) ;
_rtB = ( ( B_SY33_T * ) _ssGetModelBlockIO ( S ) ) ; ssCallAccelRunBlock ( S
, 9 , 3 , SS_CALL_MDL_ZERO_CROSSINGS ) ; _rtZCSV ->
RelationalOperator_RelopInput_ZC = _rtX -> Integrator_CSTATE - _rtB ->
B_9_3_0_k ; if ( ( _rtDW -> Integrator_MODE == 1 ) && ( _rtX ->
Integrator_CSTATE >= _rtP -> P_55 ) ) { _rtZCSV -> Integrator_IntgUpLimit_ZC
= 0.0 ; } else { _rtZCSV -> Integrator_IntgUpLimit_ZC = _rtX ->
Integrator_CSTATE - _rtP -> P_55 ; } if ( ( _rtDW -> Integrator_MODE == 2 )
&& ( _rtX -> Integrator_CSTATE <= _rtP -> P_56 ) ) { _rtZCSV ->
Integrator_IntgLoLimit_ZC = 0.0 ; } else { _rtZCSV ->
Integrator_IntgLoLimit_ZC = _rtX -> Integrator_CSTATE - _rtP -> P_56 ; } if (
( _rtDW -> Integrator_MODE == 3 ) || ( _rtDW -> Integrator_MODE == 4 ) ) {
_rtZCSV -> Integrator_LeaveSaturate_ZC = _rtB -> B_9_25_0 ; } else { _rtZCSV
-> Integrator_LeaveSaturate_ZC = 0.0 ; } _rtZCSV ->
HitCrossing_HitNoOutput_ZC = _rtB -> B_9_7_0 - _rtP -> P_57 ; if ( _rtDW ->
AutomaticGainControl_MODE ) { _rtZCSV -> RelationalOperator_RelopInput_ZC_o =
_rtB -> B_4_2_0 - _rtB -> B_4_0_0_n ; _rtZCSV ->
RelationalOperator_RelopInput_ZC_g = _rtB -> B_4_9_0 - _rtB -> B_4_1_0_p ;
_rtZCSV -> Saturation_UprLim_ZC = _rtB -> B_4_15_0 - _rtP -> P_9 ; _rtZCSV ->
Saturation_LwrLim_ZC = _rtB -> B_4_15_0 - _rtP -> P_10 ; } else { { real_T *
zcsv = & ( ( ( ZCV_SY33_T * ) ssGetSolverZcSignalVector ( S ) ) ->
RelationalOperator_RelopInput_ZC_o ) ; int_T i ; for ( i = 0 ; i < 4 ; i ++ )
{ zcsv [ i ] = 0.0 ; } } } if ( ( _rtDW -> Integrator_MODE_o == 1 ) && ( _rtX
-> Integrator_CSTATE_a >= _rtP -> P_60 ) ) { _rtZCSV ->
Integrator_IntgUpLimit_ZC_a = 0.0 ; } else { _rtZCSV ->
Integrator_IntgUpLimit_ZC_a = _rtX -> Integrator_CSTATE_a - _rtP -> P_60 ; }
if ( ( _rtDW -> Integrator_MODE_o == 2 ) && ( _rtX -> Integrator_CSTATE_a <=
_rtP -> P_61 ) ) { _rtZCSV -> Integrator_IntgLoLimit_ZC_i = 0.0 ; } else {
_rtZCSV -> Integrator_IntgLoLimit_ZC_i = _rtX -> Integrator_CSTATE_a - _rtP
-> P_61 ; } if ( ( _rtDW -> Integrator_MODE_o == 3 ) || ( _rtDW ->
Integrator_MODE_o == 4 ) ) { _rtZCSV -> Integrator_LeaveSaturate_ZC_f = _rtB
-> B_9_21_0 ; } else { _rtZCSV -> Integrator_LeaveSaturate_ZC_f = 0.0 ; }
_rtZCSV -> RelationalOperator_RelopInput_ZC_k = _rtB -> B_9_14_0 - _rtB ->
B_9_4_0 ; _rtZCSV -> Saturation2_UprLim_ZC = _rtB -> B_9_24_0 - _rtP -> P_72
; _rtZCSV -> Saturation2_LwrLim_ZC = _rtB -> B_9_24_0 - _rtP -> P_73 ;
_rtZCSV -> HitCrossing_Input_ZC [ 0 ] = _rtB -> B_9_91_0 - _rtP -> P_103 ;
_rtZCSV -> HitCrossing_Input_ZC [ 1 ] = _rtB -> B_9_92_0 - _rtP -> P_103 ;
_rtZCSV -> HitCrossing_Input_ZC [ 2 ] = _rtB -> B_9_94_0 - _rtP -> P_103 ;
_rtZCSV -> HitCrossing_Input_ZC [ 3 ] = _rtB -> B_9_90_0 - _rtP -> P_103 ;
_rtZCSV -> HitCrossing_Input_ZC [ 4 ] = _rtB -> B_9_95_0 - _rtP -> P_103 ;
_rtZCSV -> HitCrossing_Input_ZC [ 5 ] = _rtB -> B_9_93_0 - _rtP -> P_103 ; if
( _rtDW -> HitCrossing_MODE [ 0 ] == 0 ) { _rtZCSV -> HitCrossing_Output_ZC [
0 ] = ( ( _rtB -> B_9_91_0 - _rtP -> P_103 ) * ( real_T ) _rtB -> B_9_96_0 [
0 ] != 0.0 ) ; } else { _rtZCSV -> HitCrossing_Output_ZC [ 0 ] = ssGetT ( S )
- ssGetTimeOfLastOutput ( S ) ; } if ( _rtDW -> HitCrossing_MODE [ 1 ] == 0 )
{ _rtZCSV -> HitCrossing_Output_ZC [ 1 ] = ( ( _rtB -> B_9_92_0 - _rtP ->
P_103 ) * ( real_T ) _rtB -> B_9_96_0 [ 1 ] != 0.0 ) ; } else { _rtZCSV ->
HitCrossing_Output_ZC [ 1 ] = ssGetT ( S ) - ssGetTimeOfLastOutput ( S ) ; }
if ( _rtDW -> HitCrossing_MODE [ 2 ] == 0 ) { _rtZCSV ->
HitCrossing_Output_ZC [ 2 ] = ( ( _rtB -> B_9_94_0 - _rtP -> P_103 ) * (
real_T ) _rtB -> B_9_96_0 [ 2 ] != 0.0 ) ; } else { _rtZCSV ->
HitCrossing_Output_ZC [ 2 ] = ssGetT ( S ) - ssGetTimeOfLastOutput ( S ) ; }
if ( _rtDW -> HitCrossing_MODE [ 3 ] == 0 ) { _rtZCSV ->
HitCrossing_Output_ZC [ 3 ] = ( ( _rtB -> B_9_90_0 - _rtP -> P_103 ) * (
real_T ) _rtB -> B_9_96_0 [ 3 ] != 0.0 ) ; } else { _rtZCSV ->
HitCrossing_Output_ZC [ 3 ] = ssGetT ( S ) - ssGetTimeOfLastOutput ( S ) ; }
if ( _rtDW -> HitCrossing_MODE [ 4 ] == 0 ) { _rtZCSV ->
HitCrossing_Output_ZC [ 4 ] = ( ( _rtB -> B_9_95_0 - _rtP -> P_103 ) * (
real_T ) _rtB -> B_9_96_0 [ 4 ] != 0.0 ) ; } else { _rtZCSV ->
HitCrossing_Output_ZC [ 4 ] = ssGetT ( S ) - ssGetTimeOfLastOutput ( S ) ; }
if ( _rtDW -> HitCrossing_MODE [ 5 ] == 0 ) { _rtZCSV ->
HitCrossing_Output_ZC [ 5 ] = ( ( _rtB -> B_9_93_0 - _rtP -> P_103 ) * (
real_T ) _rtB -> B_9_96_0 [ 5 ] != 0.0 ) ; } else { _rtZCSV ->
HitCrossing_Output_ZC [ 5 ] = ssGetT ( S ) - ssGetTimeOfLastOutput ( S ) ; }
for ( i = 0 ; i < 6 ; i ++ ) { _rtZCSV -> RelationalOperator2_RelopInput_ZC [
i ] = _rtB -> B_9_57_0 [ i ] - _rtB -> B_9_0_0_m ; _rtZCSV ->
RelationalOperator4_RelopInput_ZC [ i ] = _rtB -> B_9_57_0 [ i ] - _rtB ->
B_9_64_0 [ i ] ; _rtZCSV -> RelationalOperator1_RelopInput_ZC [ i ] = _rtB ->
B_9_97_0 [ i ] - _rtB -> B_9_23_0_g ; _rtZCSV ->
RelationalOperator2_RelopInput_ZC_n [ i ] = _rtB -> B_9_114_0 [ i ] - _rtB ->
B_9_24_0_m ; } } static void mdlInitializeSizes ( SimStruct * S ) {
ssSetChecksumVal ( S , 0 , 2454308081U ) ; ssSetChecksumVal ( S , 1 ,
449485398U ) ; ssSetChecksumVal ( S , 2 , 52784013U ) ; ssSetChecksumVal ( S
, 3 , 2305894633U ) ; { mxArray * slVerStructMat = NULL ; mxArray * slStrMat
= mxCreateString ( "simulink" ) ; char slVerChar [ 10 ] ; int status =
mexCallMATLAB ( 1 , & slVerStructMat , 1 , & slStrMat , "ver" ) ; if ( status
== 0 ) { mxArray * slVerMat = mxGetField ( slVerStructMat , 0 , "Version" ) ;
if ( slVerMat == NULL ) { status = 1 ; } else { status = mxGetString (
slVerMat , slVerChar , 10 ) ; } } mxDestroyArray ( slStrMat ) ;
mxDestroyArray ( slVerStructMat ) ; if ( ( status == 1 ) || ( strcmp (
slVerChar , "10.0" ) != 0 ) ) { return ; } } ssSetOptions ( S ,
SS_OPTION_EXCEPTION_FREE_CODE ) ; if ( ssGetSizeofDWork ( S ) != sizeof (
DW_SY33_T ) ) { ssSetErrorStatus ( S ,
"Unexpected error: Internal DWork sizes do "
"not match for accelerator mex file." ) ; } if ( ssGetSizeofGlobalBlockIO ( S
) != sizeof ( B_SY33_T ) ) { ssSetErrorStatus ( S ,
"Unexpected error: Internal BlockIO sizes do "
"not match for accelerator mex file." ) ; } { int ssSizeofParams ;
ssGetSizeofParams ( S , & ssSizeofParams ) ; if ( ssSizeofParams != sizeof (
P_SY33_T ) ) { static char msg [ 256 ] ; sprintf ( msg ,
"Unexpected error: Internal Parameters sizes do "
"not match for accelerator mex file." ) ; } } _ssSetModelRtp ( S , ( real_T *
) & SY33_rtDefaultP ) ; rt_InitInfAndNaN ( sizeof ( real_T ) ) ; ( ( P_SY33_T
* ) ssGetModelRtp ( S ) ) -> P_9 = rtInf ; ( ( P_SY33_T * ) ssGetModelRtp ( S
) ) -> P_55 = rtInf ; ( ( P_SY33_T * ) ssGetModelRtp ( S ) ) -> P_56 =
rtMinusInf ; ( ( P_SY33_T * ) ssGetModelRtp ( S ) ) -> P_60 = rtInf ; ( (
P_SY33_T * ) ssGetModelRtp ( S ) ) -> P_72 = rtInf ; } static void
mdlInitializeSampleTimes ( SimStruct * S ) { slAccRegPrmChangeFcn ( S ,
mdlOutputsTID2 ) ; } static void mdlTerminate ( SimStruct * S ) { }
#include "simulink.c"
